//
//  WithdrawRecordCell.m
//  GasBusiness
//
//  Created by zfc on 2021/8/21.
//

#import "WithdrawRecordCell.h"

@interface WithdrawRecordCell ()
@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UILabel *timeLab;

@property (nonatomic, strong) UILabel *countLab;

@end

@implementation WithdrawRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setUI {
    UILabel *nameLab = [[UILabel alloc] init];
    nameLab.text = @"";
    nameLab.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
    nameLab.textColor = Color333;
    [self.contentView addSubview:nameLab];
    self.nameLab = nameLab;
    [nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.leading.equalTo(self.contentView).offset(15);
    }];

    UILabel *timeLab = [[UILabel alloc] init];
    timeLab.text = @"";
    timeLab.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
    timeLab.textColor = Color999;
    [self.contentView addSubview:timeLab];
    self.timeLab = timeLab;
    [timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(43);
        make.leading.equalTo(self.contentView).offset(15);
        make.bottom.equalTo(self.contentView).offset(-15);
    }];

    UILabel *countLab = [[UILabel alloc] init];
    countLab.text = @"";
    countLab.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
    countLab.textColor = BlackColor;
    [self.contentView addSubview:countLab];
    self.countLab = countLab;
    [countLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.trailing.equalTo(self.contentView).offset(-15);
    }];

    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = ColorE6;
    [self.contentView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.leading.trailing.equalTo(self.contentView);
        make.height.mas_equalTo(0.5);
    }];
}

- (void)setDic:(NSDictionary *)dic {
    _dic = dic;

    NSInteger account_type = [dic[@"account_type"] intValue];
    NSString *type = @"其他账户";
    if (account_type == 1) { //银行卡
        type = @"银行卡";
    }

    if (account_type == 2) { //微信
        type = @"微信";
    }

    if (account_type == 3) { //支付宝
        type = @"支付宝";
    }

    self.nameLab.text = [NSString stringWithFormat:@"提现到%@", type];
    self.timeLab.text = [NSString stringWithFormat:@"%@", [Untils setTimeWithTime:dic[@"created_at"] format:@"yyyy.MM.dd HH:mm"]];
    self.countLab.text = [NSString stringWithFormat:@"+%@", dic[@"transfer_money"]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
